﻿@model List<DatNuocViet.Models.Tour>

@{
    Layout = null;
    int nToursPage = (Model.Count + 2 - 1) / 2;
    int toursIndex = 0;
    string classname = "products-grid";
    string lang = (Session["Language"] == null) ? "vi" : Session["Language"].ToString();
}

@for (int i = 0; i < Model.Count; i = i + 2)
{
    if (toursIndex == nToursPage)
    {
        classname = "products-grid ul_last";
    }

    toursIndex++;
    
<ul class="@classname">
    <li class="item first"><a href="/tours/details/@Model[i].Id" title="@if (lang == "en")
                                                                        { @Html.Raw(Model[i].NameEn);
                                                                        }
                                                                        else
                                                                        { @Html.Raw(Model[i].NameVn);
                                                                        }" class="product-image">
        <img src="@DatNuocViet.Models.ToursDAO.GetImageTours(Model[i].Id)" width="140" height="140" alt="@if (lang == "en")
                                                                                                         { @Html.Raw(Model[i].NameEn);
                                                                                                         }
                                                                                                         else
                                                                                                         { @Html.Raw(Model[i].NameVn);
                                                                                                         }" /></a>
        <h3 class="product-name">
            <a href="/tours/details/@Model[i].Id" title="@if (lang == "en")
                               { @Html.Raw(Model[i].NameEn);
                               }
                               else
                               { @Html.Raw(Model[i].NameVn);
                               }">@if (lang == "en")
                                                                                                                        { @Html.Raw(Model[i].NameEn);
                                                                                                                        }
                                                                                                                        else
                                                                                                                        { @Html.Raw(Model[i].NameVn);
                                                                                                                        }</a>
            @{
                DateTime d = Model[i].CreateOn ?? DateTime.Now;
                bool month = (d.Month <= DateTime.Now.Month) ? true : false;
                if (month)
                {
                    @Html.Raw(@"<img src='../../images/new_animated3.gif' hspace='5'/>");
                }
              }    
        </h3>
        <div class="price-box">
            @if (Model[i].Price == 0)
            {
            <span class="regular-price" id="product-price-67-new1"><span class="price">@DatNuocViet.Ultility.Helper.Label("text_gia")</span>
            </span>
            }
            else
            {
                decimal gia = Model[i].Price ?? 0;
            <span class="regular-price" id="product-price-67-new1"><span class="price">@gia.ToString("0,0", System.Globalization.CultureInfo.CreateSpecificCulture("el-GR")) VNĐ</span>
            </span>
            }
        </div>
        <div class="actions">
            <button type="button" title="Xem chi tiết" class="button btn-cart" onclick="setLocation('/tours/details/@Model[i].Id')">
                <span><span>@DatNuocViet.Ultility.Helper.Label("text_xemchitiet")</span></span></button>
        </div>
    </li>
    @if (i + 1 < Model.Count)
    {
    <li class="item last"><a href="/tours/details/@Model[i + 1].Id" title="@if (lang == "en")
                                                                         { @Html.Raw(Model[i].NameEn);
                                                                         }
                                                                         else
                                                                         { @Html.Raw(Model[i].NameVn);
                                                                         }" class="product-image">
        <img src="@DatNuocViet.Models.ToursDAO.GetImageTours(Model[i + 1].Id)" width="140" height="140" alt="@if (lang == "en")
                                                                                                           { @Html.Raw(Model[i].NameEn);
                                                                                                           }
                                                                                                           else
                                                                                                           { @Html.Raw(Model[i].NameVn);
                                                                                                           }" /></a>
        <h3 class="product-name">
            <a href="/tours/details/@Model[i+1].Id" title="@if (lang == "en")
                               { @Html.Raw(Model[i+1].NameEn);
                               }
                               else
                               { @Html.Raw(Model[i+1].NameVn);
                               }">@if (lang == "en")
                                                                                                                        { @Html.Raw(Model[i + 1].NameEn);
                                                                                                                        }
                                                                                                                        else
                                                                                                                        { @Html.Raw(Model[i + 1].NameVn);
                                                                                                                        }</a>
        @{
                DateTime d1 = Model[i + 1].CreateOn ?? DateTime.Now;
                bool month1 = (d.Month <= DateTime.Now.Month) ? true : false;
                if (month1)
                {
                    @Html.Raw(@"<img src='../../images/new_animated3.gif' hspace='5'/>");
                }
              } 
        </h3>
        <div class="price-box">
            @if (Model[i + 1].Price == 0)
            {
            <span class="regular-price" id="product-price-67-new1"><span class="price">@DatNuocViet.Ultility.Helper.Label("text_gia")</span>
            </span>
            }
            else
            {
                decimal gia = Model[i+1].Price ?? 0;
            <span class="regular-price" id="product-price-67-new1"><span class="price">@gia.ToString("0,0", System.Globalization.CultureInfo.CreateSpecificCulture("el-GR")) VNĐ</span>
            </span>
            }
        </div>
        <div class="actions">
            <button type="button" title="Xem chi tiết" class="button btn-cart" onclick="setLocation('/tours/details/@Model[i + 1].Id')">
                <span><span>@DatNuocViet.Ultility.Helper.Label("text_xemchitiet")</span></span></button>
        </div>
    </li>
    }
</ul>
}
